package com.jvup.gameshow.controller;

import android.view.View;

import androidx.annotation.NonNull;

import com.jvup.common.constant.CacheStorageKey;
import com.jvup.common.support.base.EventController;
import com.jvup.common.utils.CacheStorageUtil;
import com.jvup.gameshow.activity.MainActivity;
import com.jvup.gameshow.model.viewModel.impl.MainViewModel;

public class MainController extends EventController<MainActivity> {

    private MainViewModel viewModel;

    public MainController(@NonNull MainActivity lifecycleOwner) {
        super(lifecycleOwner);
    }

    @Override
    protected void bindView() {
        owner.viewDataBinder().setMainController(this);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        this.viewModel = null;
    }

    public void onAddition(MainViewModel viewModel) {
        this.viewModel = viewModel;
    }

    /**********************************************************************************************/

    public void adOnClick(View view) {

    }

    public void skipBtnOnClick(View view) {
        owner.closePage(true);
    }

    public void serviceTermsOnClick(View view) {
//        WebDetailActivity.start(view.getContext(), Url.dialog_serviceTerms_url,"服务条款");
    }

    public void privacyPolicyOnClick(View view) {
//        WebDetailActivity.start(view.getContext(), Url.dialog_privacyPolicy_url,"隐私条款");
    }

    public void integrationOnClick(View view) {
//        WebDetailActivity.start(view.getContext(), Url.dialog_integration_url,"完整条款");
    }

    public void okBtnOnClick(View view) {
        CacheStorageUtil.save(CacheStorageKey.FIRST_SHOW_USER_AGREEMENT, false);
        viewModel.playAd();
    }

}
